home *** CD-ROM | disk | FTP | other *** search
- >
- > Suppose I have the following application structure:
- >
- >
- >
- > ---------------------
- > my.exe
- > ---------------------
- > | |
- > | |
- > | |
- > ^ ^
- > ------------ ---------------
- > auth.dll gen.dll
- > ------------ ---------------
- > | |
- > | |
- > | |
- > -----------------
- > winsock.dll
- > -----------------
- >
- >
- > Should I call WSAStartup() in my.exe and not in the other two DLLs or
- > should I call it in auth.dll and gen.dll? Can WSACleanup() be called in a
- > wep()? What are the advantages/disavantages?
- >
- >
-
- The 1.1 spec clearly states that WSAStartup()/WSACleanup() are used on
- per-task basis. You can call them anywhere in your exe/dlls as long as
- you know which task the WSAStartup()/WSACleanup() are referring to.
-
- In your setup, I would say do it in my.exe would be easiest. You can do
- it in your dlls too; however, you will have to build a task table to keep
- track of the details.
-
- May I suggest you create another DLL that deals with Winsock exclusively
- and have your auth.dll and gen.dll interact with it? It makes thing much
- simpler and clearer.
-
- William
- --
- william@sybase.com
- From william@sybase.com Mon May 2 05:14:13 1994
- Received: from halon.sybase.com by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
- id AA27329; Mon, 2 May 1994 15:13:52 -0400
- Received: from sybase.com (sybgate.sybase.com) by halon.sybase.com (5.0/SMI-SVR4/SybFW4.0)
- id AA10741; Mon, 2 May 1994 12:16:40 +0800
- Received: from mercury.sybgate.sybase.com (mercury-1) by sybase.com (4.1/SMI-4.1/SybH3.3)
- id AA12227; Mon, 2 May 94 12:13:49 PDT
- Received: by mercury.sybgate.sybase.com (4.1/SMI-4.1/SybEC3.2)
- id AA27022; Mon, 2 May 94 12:14:14 PDT
- From: william@sybase.com (William Wong)
- Message-Id: <9405021914.AA27022@mercury.sybgate.sybase.com>
- Subject: Re: Q: How to connect with a timeout ?
- To: winsock-hackers@SunSITE.Unc.EDU (Roger Kries)
- Date: Mon, 2 May 94 12:14:13 PDT
- In-Reply-To: <199404181056.AA20414@SunSITE.Unc.EDU>; from "Roger Kries" at Apr 30, 94 12:07 pm
- X-Mailer: ELM [version 2.3 PL0]
- Content-Length: 780
-
- >
- > If at the moment of the connect call, the remote machine has no socket
- > created that listens to the specified port, the following select() call
- > will always timeout, even if during the timeout interval a program is
- > started that listens to the port. That means that in the case where a
- > blocking connect call would return ECONNREFUSED, a non-blocking returns
- > WSAWOULDBLOCK, but the select call always timeouts.
- >
- > So how can I find out if the remote machine is listening to a specific
- > TCP port without blocking and in a Berkley Socket compatible manner?
- >
- > Any suggestions are welcome. Thanx in advance.
- >
-
- You can always do your own clock counting. Call select() with zero timeout
- in a loop that you do the timeout logic.
-
- William
- --
- william@sybase.com
-
-